package GenderCount.controllor;


import com.alibaba.fastjson.JSONObject;
import GenderCount.daoimpl.DaoImpl;
import GenderCount.vo.Show_Data;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/ads_stu_info")
public class Servlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        DaoImpl examDao = new DaoImpl();//实例化DaoImpl
        Show_Data data = examDao.getTotalCount();//调用DaoImpl的方法
        String jsondata = JSONObject.toJSONString(data);//将数据转换为json格式
        resp.setCharacterEncoding("utf-8");//设置编码格式
        resp.getWriter().write(jsondata);//将数据返回给前端
    }

}
